package com.example.pages;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class ProfilePage extends InternalPage {
	@FindBy(id = "username")
	public WebElement usernameField;

	@FindBy(name = "email")
	public WebElement emailField;

	@FindBy(id = "password")
	public WebElement passwordField;

	@FindBy(id = "password2")
	public WebElement password2Field;

	@FindBy(name = "submit")
	public WebElement submitButton;

	public void submitForm() {
		submitButton.click();
	}

	public UserPage changePass(String newPass, String Pass2) {
		emailField.clear();
		emailField.sendKeys(email);
		passwordField.clear();
		passwordField.sendKeys(newPass);
		password2Field.clear();
		password2Field.sendKeys(Pass2);
		submitButton.click();
		return MyPageFactory.getPage(driver, UserPage.class);
	}

	public ProfilePage changePassWrong(String newPass,
			String incorrectConfirmPass) {
		emailField.clear();
		emailField.sendKeys(email);
		passwordField.clear();
		passwordField.sendKeys(newPass);
		password2Field.clear();
		password2Field.sendKeys(incorrectConfirmPass);
		submitButton.click();
		return MyPageFactory.getPage(driver, ProfilePage.class);
	}
}